        <?php
			include_once '../classes/database.php';
            $dbo = Database::getDBOInstance();
            
			//Generating the values that are needed to be displayed here
			
			//Includes details on how many exams are open
			$var_totalexams = 0;
			//Tells how many exams have been allocated (enaugh supervisors for the exam)
			$var_exam_allocation_complete = 0;
			//Tells how many supervisors are available
			$var_totalsupervisors = 0;
			//Tells how many supervisors have completed allocation
			$var_supervisor_allocation_complete = 0;
			//The student / supervisor ratio
			$var_std_sup_ratio = 0;
			//The supervisor minimum sub/exam count
			$var_sup_exam_mincount;
			
			//include 'config.php';

			//$connection = mysql_connect($db_host, $db_username, $db_password) or die('Error in db connection ' . mysql_error() );
			//$db = mysql_select_db($db_name) or die('Error in selecting database ' . mysql_error() );
			
			//Get the ratio that says how many students are to be supervised by a supervisor
			$query = "select value from general where property = 'std_sup_ratio'";
			$result = $dbo->mysql_query($query);
            
			$row = mysql_fetch_assoc($result);
			$var_std_sup_ratio = $row['value'];
			
			//Finding the total number of supervisors available
			$query = "select * from sase_supervisor where sup_available = 1";
			$result = $dbo->mysql_query($query);
			$var_totalsupervisors = mysql_num_rows($result);
			
            //echo 'std sup' .$var_std_sup_ratio;
            
			//Finding how many supervisors have completed their minimum allocations
			$query = "select * from supervisor_sub_count where sup_count >= $var_std_sup_ratio";
			$result = $dbo->mysql_query($query);
			$var_supervisor_allocation_complete = mysql_num_rows($result);
            $var_supervisor_allocation_complete = Supervisor::getUnallocatedSupervisors();
            $var_supervisor_allocation_complete = $var_totalsupervisors - count($var_supervisor_allocation_complete);

			//Finding the total number of exams available
			$query = "select * from sase_subject where sub_available = 1";
			$result = $dbo->mysql_query($query);
			$var_totalexams = mysql_num_rows($result);
			
			//Get the minimum subject count of the supervisor from the general database
			$query = "select value from general where property = 'sup_exam_mincount'";
			$result = $dbo->mysql_query($query);
			$row = mysql_fetch_assoc($result);
			$var_sup_exam_mincount = $row['value'];
			
			//Finding out how many subjects that have supervisors sufficiently allocated
			$query = "select * from 
						subject_sup_count as ssc, 
						sase_subject as ss 
						where 
							ssc.sub_code = ss.sub_code and 
							ss.sub_stdcount / ssc.sub_count <= $var_sup_exam_mincount";
			$result = $dbo->mysql_query($query);
			$var_exam_allocation_complete = mysql_num_rows($result);
            
            $var_exam_allocation_complete = Subject::getUnallocatedSubjects();
            $var_exam_allocation_complete = $var_totalexams - count($var_exam_allocation_complete);/**/
		?>
        
        <center>
          <table width="95%" border="0"">
            <tr>
              <td colspan="2" align="center"><u>Exams</u></td>
            </tr>
            <tr>
              <td width="45%" align="right">Total exams :</td>
              <td width="55%"><?php echo $var_totalexams; ?></td>
            </tr>
            <tr>
              <td align="right">Allocated :</td>
              <td><?php echo $var_exam_allocation_complete; ?></td>
            </tr>
            <tr>
              <td align="right">Unallocated :</td>
              <td><?php echo $var_totalexams - $var_exam_allocation_complete; ?></td>
            </tr>
            <tr>
              <td colspan="2" align="center"><hr style="padding:0px; margin:0px; border-color:#CCC;" />                [unallocated list]</td>
            </tr>
          </table>
          
          <table width="95%" border="0" style="margin-top:20px;">
            <tr>
              <td colspan="2" align="center"><u>Supervisors</u></td>
            </tr>
            <tr>
              <td width="45%" align="right">Total  :</td>
              <td width="55%"><?php echo $var_totalsupervisors; ?></td>
            </tr>
            <tr>
              <td align="right">Allocated :</td>
              <td><?php echo $var_supervisor_allocation_complete; ?></td>
            </tr>
            <tr>
              <td align="right">Unallocated :</td>
              <td><?php echo $var_totalsupervisors - $var_supervisor_allocation_complete; ?></td>
            </tr>
            <tr>
              <td colspan="2" align="center"><hr style="padding:0px; margin:0px; border-color:#CCC;" />                [unallocated list]</td>
            </tr>
          </table>
          
          </center>
